'''
@Project ：hdcms-scripts
@File    ：base_api.py
@IDE     ：PyCharm
@Author  ：朱广杰
@Date    ：2024/11/11 14:14
'''
import requests

from common.client import RequestsClient
from common.FILE_PATH import load_yaml_file


class BaseUserApi(RequestsClient):
    user_token = ''
    def __init__(self):
        super().__init__()
        self.host = load_yaml_file('/config/http.yml')['user']
        self.headers = {
            'Authorization': BaseUserApi.user_token,
            'Content-Type': 'application/json'
        }

class BaseCapiApi(RequestsClient):
    capi_token = ''
    def __init__(self):
        super().__init__()
        self.host = load_yaml_file('/config/http.yml')['capi']
        self.headers = {
            'Authorization': BaseCapiApi.capi_token,
            'Content-Type': 'application/json'
        }

class BaseCourseApi(RequestsClient):
    course_token = ''
    def __init__(self):
        super().__init__()
        self.host = load_yaml_file('/config/http.yml')['course']
        self.headers = {
            'Authorization': BaseCourseApi.course_token,
            'Content-Type': 'application/json'
        }


class BaseCmsv2Api(RequestsClient):
    course_token = ''
    def __init__(self):
        super().__init__()
        self.host = load_yaml_file('/config/http.yml')['cmsv2']
        self.headers = {
            'Authorization': BaseCmsv2Api.course_token,
            'Content-Type': 'application/json'
        }


class BaseCallbackApi(RequestsClient):
    course_token = ''
    def __init__(self):
        super().__init__()
        self.host = load_yaml_file('/config/http.yml')['callback']
        self.headers = {
            'Authorization': BaseCallbackApi.course_token
        }
